import { h } from 'vue'

import useDictionaryStore from '~stores/module/dictionary'
const { gender, userStatus } = useDictionaryStore()

export const roleConfig = {
  headList: [
    {
      label: '角色名称',
      prop: 'name'
    },
    {
      label: '角色编码',
      prop: 'code'
    },
    {
      label: '角色描述',
      prop: 'description'
    },
    {
      label: '创建人',
      prop: 'created_by'
    }
  ]
}

export const userConfig = {
  headList: [
    {
      label: '用户名',
      prop: 'username'
    },
    {
      label: '部门',
      prop: 'department'
    },
    {
      label: '岗位',
      prop: 'position'
    },
    {
      label: '性别',
      prop: 'gender',
      slot: true,
      render: (row) => {
        return h(
          'span',
          gender[row.gender]
        )
      }
    },
    {
      label: '手机号',
      prop: 'phone_number'
    },
    {
      label: '邮箱',
      prop: 'email'
    },
    {
      label: '角色',
      prop: 'role'
    },
    {
      label: '状态',
      prop: 'status',
      slot: true,
      render: (row) => {
        return h(
          'el-tag',
          {
            class: row.status === 1
              ? 'el-tag el-tag--success el-tag--light'
              : 'el-tag el-tag--danger el-tag--light'
          },
          userStatus[row.status]
        )
      }
    }
  ]
}

export const departmentConfig = {
  headList: [
    {
      label: '部门名称',
      prop: 'name'
    },
    {
      label: '部门编码',
      prop: 'code'
    },
    {
      label: '部门描述',
      prop: 'description'
    },
    {
      label: '创建人',
      prop: 'created_by'
    }
  ]
}

export const positionConfig = {
  headList: [
    {
      label: '岗位名称',
      prop: 'name'
    },
    {
      label: '岗位编码',
      prop: 'code'
    },
    {
      label: '岗位描述',
      prop: 'description'
    },
    {
      label: '创建人',
      prop: 'created_by'
    }
  ]
}
